package com.ruoyi.order.service.impl;

import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.order.domain.AddressVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.order.mapper.VerAddressMapper;
import com.ruoyi.order.domain.VerAddress;
import com.ruoyi.order.service.IVerAddressService;

/**
 * 地址Service业务层处理
 *
 * @author ruoyi
 * @date 2025-08-21
 */
@Service
public class VerAddressServiceImpl implements IVerAddressService {
    @Autowired
    private VerAddressMapper verAddressMapper;

    private AtomicLong idGenerator = new AtomicLong();

    /**
     * 查询地址
     *
     * @param id 地址主键
     * @return 地址
     */
    @Override
    public VerAddress selectVerAddressById(Long id) {
        return verAddressMapper.selectVerAddressById(id);
    }

    /**
     * 查询地址列表
     *
     * @param addressVo 地址
     * @return 地址
     */
    @Override
    public List<AddressVo> selectVerAddressList(AddressVo addressVo) {
        return verAddressMapper.selectVerAddressList(addressVo);
    }

    /**
     * 新增地址
     *
     * @param verAddress 地址
     * @return 结果
     */
    @Override
    public int insertVerAddress(VerAddress verAddress) {
        verAddress.setCreateTime(DateUtils.getNowDate());
        return verAddressMapper.insertVerAddress(verAddress);
    }

    /**
     * 修改地址
     *
     * @param verAddress 地址
     * @return 结果
     */
    @Override
    public int updateVerAddress(VerAddress verAddress) {
        verAddress.setUpdateTime(DateUtils.getNowDate());
        return verAddressMapper.updateVerAddress(verAddress);
    }

    /**
     * 批量删除地址
     *
     * @param ids 需要删除的地址主键
     * @return 结果
     */
    @Override
    public int deleteVerAddressByIds(Long[] ids) {
        return verAddressMapper.deleteVerAddressByIds(ids);
    }

    /**
     * 删除地址信息
     *
     * @param id 地址主键
     * @return 结果
     */
    @Override
    public int deleteVerAddressById(Long id) {
        return verAddressMapper.deleteVerAddressById(id);
    }
}
